(function(){
	if(!window.mc){
		window.mc = function(){};
	}
	var tmp = [
["q","й"],
["w","ц"],
["e","у"],
["r","к"],
["t","е"],
["y","н"],
["u","г"],
["i","ш"],
["o","щ"],
["p","з"],
["[","х"],
["]","ъ"],
["a","ф"],
["s","ы"],
["d","в"],
["f","а"],
["g","п"],
["h","р"],
["j","о"],
["k","л"],
["l","д"],
[";","ж"],
["'","э"],
["z","я"],
["x","ч"],
["c","с"],
["v","м"],
["b","и"],
["n","т"],
["m","ь"],
[",","б"],
[".","ю"],
["/","."],

["Q","Й"],
["W","Ц"],
["E","У"],
["R","К"],
["T","Е"],
["Y","Н"],
["U","Г"],
["I","Ш"],
["O","Щ"],
["P","З"],
["{","Х"],
["}","Ъ"],
["A","Ф"],
["S","Ы"],
["D","В"],
["F","А"],
["G","П"],
["H","Р"],
["J","О"],
["K","Л"],
["L","Д"],
[",","Ж"],
["\"","Э"],
["Z","Я"],
["X","Ч"],
["C","С"],
["V","М"],
["B","И"],
["N","Т"],
["M","Ь"],
["<","Б"],
[">","Ю"],
["?",","]
];
	mc._tr_c2l = {};
	mc._tr_l2c = {};

	for(var i = 0; i < tmp.length; i++){
		mc._tr_c2l[tmp[i][1]] = tmp[i][0];
		mc._tr_l2c[tmp[i][0]] = tmp[i][1];
	}

	mc.translate = function(to_c){
		var tr;
		if(to_c){
			tr = mc._tr_l2c;
		}else{
			tr = mc._tr_c2l;
		}
		return function(){
			var v = mc.inputer.current();
			var t = v.match(/((?:to|private|для|лично)\s*\[[^\]]+\]\s*)?(.*)/);
			if(t && t[2]){
				v = "";
				if(t[1]){
					v += t[1];
				}
				if(t[2]){
					v += t[2].replace(/(.)/ig,function(s,c){
						if(tr[c]){
							return tr[c]
						}else{
							return  c;
						}
					});
				}
				mc.inputer.rewrite(v);
			}
		};
	}

})();
